package com.liuxing.doctor.service.impl;

import com.liuxing.doctor.entity.MedicalRecord;
import com.liuxing.doctor.mapper.MedicalRecordMapper;
import com.liuxing.doctor.service.MedicalRecordService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * @athuer 行柳
 */
@Service
@Slf4j
public class MedicalRecordServiceImpl implements MedicalRecordService {
    @Resource
    private MedicalRecordMapper medicalRecordMapper;
    @Override
    public MedicalRecord queryById(int id) {
        return medicalRecordMapper.selectById(id);
    }

    @Override
    public int updateMedicalRecord(Map<String, Object> map) {
        return medicalRecordMapper.updateMedicalRecord(map);
    }

    @Override
    public int createMedicalRecord(Map<String, Object> map) {
        return medicalRecordMapper.insertMedicalRecord(map);
    }

    @Override
    public List<MedicalRecord> queryByPatientId(String id) {
        return medicalRecordMapper.selectByPatientId(id);
    }

    @Override
    public int deleteMedicalRecord(String patient_id) {
        return medicalRecordMapper.deleteMedicalRecord(patient_id);
    }

    @Override
    public int insertMedicalRecord (MedicalRecord medicalRecord) {
        return medicalRecordMapper.insertOneMedicalRecord(medicalRecord);
    }
}
